<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
    <head>
        <title>管理博友</title>
        <meta name="search" content="price" />
        <meta name="author" content="chunhai.chen(15317227@qq.com)" />
        <meta name="META_MAIN_MENU_ID" content="ADMIN_BUDDIES" />
        <c:set var="trailLinks" value=""></c:set>
    </head>
    <body>
        <div style="padding:20px;">
            <table width='100%' id="customerTable" class="yui-grid">
                <thead>
                    <tr>
                        <th colspan="9" align='left'> <p style='font-size: 20px;margin:0'> 博友列表 </p> </th>                        
                    </tr>
					
		            <tr>
		                  <th nowrap></th> <th nowrap> 头像 </th> <th nowrap> 昵称 </th> <th nowrap> 电邮地址 </th> <th nowrap> 博客地址  </th>     <th nowrap> 加入时间 </th> 
		            </tr>
				</thead>						
	           	<form action="/admin/buddy/list/delete.htm" method="GET" name="delform">
                <tbody>
                	<c:choose>
                		<c:when  test="${not empty buddies}">
	                        <c:forEach items="${buddies}" var="v" varStatus="vst">
	                            <tr>                                
	                                <td width=1> <input type='checkbox' name='uid' value='${v.uid}'> </td>    
	                                <td width='1px' nowrap>
	                                	<img width="32" height="32" alt="" src="/avatar/icon/${v.uid}.avatar" class="avatar avatar-32 photo">
	                               	</td>
	                                                           
	                                <td width='1px' nowrap><c:out value="${v.name }"></c:out></td>
	                                <td width='1px' nowrap><c:out value="${v.email }"></c:out></td>
	                                <td width='1px' nowrap> <A href="http://${v.blogUrl }">${v.blogUrl}</A> </td>
	                                                     
	                                <td width='1px' nowrap> 
										 <fmt:formatDate value="${v.lastUpdated }" pattern ="yyyy-MM-dd HH:mm" />  
									</td>
									

	                            </tr>
	                        </c:forEach>
                		</c:when>
                		<c:otherwise>
                			<tr><td colspan="8">没有博友</td></tr>
                		</c:otherwise>
                	</c:choose>
                </tbody>
		        <thead>
		            <tr>
		                  <th> <input type="submit" name="submit" value="删除"/> <th nowrap> 头像 </th>	<th nowrap> 昵称 </th> <th nowrap> 电邮地址 </th> <th nowrap> 博客地址  </th>   <th nowrap> 加入时间 </th> 

		            </tr>
				</thead>	
				</form>					
				
				<c:if test="${totalItems > pageSize}">
		        <thead>
		            <tr>
		                  <th colspan="7">
							<div id="Pagination" class="pagination"></div>		                  
							
								<c:set var="requester" value="<%=request.getServerName()+ (request.getServerPort()==80 ? "" : ":"+request.getServerPort())%>"/>
								<script type="text/javascript" src="/js/jquery.pagination.js"></script>
						 		<script type="text/javascript">
						            /**
						             * Callback function that displays the content.
						             *
						             * Gets called every time the user clicks on a pagination link.
						             *
						             * @param {int}page_index New Page index
						             * @param {jQuery} jq the container with the pagination links as a jQuery object
						             */
									function pageselectCallback(page_index, jq){
						                // Replace old content with new content
										// $('#Searchresult').html(newcontent);
										// return false;
						                
						                return true;
						            }
						            
						
						            // When document has loaded, initialize pagination and form 
						            $(document).ready(function(){
										<c:choose>
									        <c:when test="${not empty currentArticle}">
												var url="/admin/buddy/list.htm?articleUid=${currentArticle.uid}.htm&pageNo=__id__&pageSize=${pageSize}";
											</c:when>
											<c:otherwise>
												var url="/admin/buddy/list.htm?articleUid=&pageNo=__id__&pageSize=${pageSize}";
											</c:otherwise>
										</c:choose>
						
										var totalItems = "${totalItems}";
						                var optInit = {
														callback: pageselectCallback,
														current_page: "${pageNo}",
														link_to: url,
														items_per_page: "${pageSize}",
														num_display_entries: 8,
														num_edge_entries: 2,
														prev_text: "上一页",
														next_text: "下一页"
													};
						                $("#Pagination").pagination(totalItems, optInit);              
						            });
						            
						        </script>
						  </th>
		            </tr>
				</thead>	
				</c:if>				
            </table>
        </div>
    </body>
</html>
